import java.util.jar.*;

public class EventParser
{
	VoIPEvent event;
	String lastElem;
	int cnt;
	
	public EventParser()
	{
		cnt = 0;
		lastElem = new String();
		event = new VoIPEvent();
	}//constructor

	public void Reset()
	{
		lastElem = "";
		cnt = 0;
		event.Reset();
	}//Reset
	
	public void startElement(String name)
	{
		System.out.println("				startElement: " + name);

		lastElem = name;
		cnt++;
	}//startElement

	public void endElement(String name)
	{
		System.out.println("				endElement: " + name);

		cnt--;
		if(cnt == 0) {
			System.out.println("	Setting type: " + name);
			event.SetType(name);
		}//if
	}//endElement
	
	public void characters(String val)
	{
		System.out.println("		Adding: " + lastElem + " / " + val);

		event.AddEntry(lastElem, val);
	}//characters

}//EventParser

